<?php

namespace App\Http\Controllers;
use App\User;
use App\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Gregwar\Captcha\CaptchaBuilder;
use Session;

class LoginController extends Controller
{
    /**
     * 展示给定用户的信息。
     *
     * @param  int  $id
     * @return Response
     */

    public function login(){

    	   return view('login.login');
    }


    public function denglu(){

    	 return redirect('admin/index/index');
    }

    public function captcha($tmp){

        header('Content-type: image/jpeg');
        //生成验证码图片的Builder对象，配置相应属性
        $builder = new CaptchaBuilder;
        //可以设置图片宽高及字体
        $builder->build($width = 100, $height = 40, $font = null);
        //获取验证码的内容
        $phrase = $builder->getPhrase();
        //把内容存入session
        Session::flash('milkcaptcha', $phrase);
        //生成图片
        header("Cache-Control: no-cache, must-revalidate");
        header('Content-Type: image/jpeg');
        $builder->output();

    }


    public function getyzmcode(){
        if(Session::get('milkcaptcha')!=$code) {
                    return array("code"=>2,"msg"=>"验证码错误");
        }
    }

}